package com.ebraga.trackerclub.android.dao.api;

import java.util.List;

import com.ebraga.trackerclub.android.dao.entity.PositionAndroid;
import com.ebraga.trackerclub.android.exception.BackofficeDBConnectionException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeDaoException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeIllegalArgumentDaoException;

public interface PositionDao {
	
	/**
	 * Insert User in the local database android
	 * 
	 * @param PositionAndroid
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException 
	 */
	void insert(PositionAndroid position) throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 * Return pending position from local database android.
	 * 
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 */
	List<PositionAndroid> retrievePositionsToSync() throws BackofficeDBConnectionException, BackofficeDaoException;

	/**
	 * Return all pending positions referenced by checkInOut from local data base.
	 *   
	 * @return all pending positions referenced by checkInOut from local data base
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 */
	List<PositionAndroid> retrieveCheckInOutPositionsToSync() throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 * Mark all given position data as synchronized updating synchronization date with current date time;
	 * 
	 * @param positionList position list to be marked as synchronized
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 * @throws BackofficeDaoException if occurs another error.
	 */
	void markAsSynchronized(List<PositionAndroid> positionList) throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 *last recorded position of the User
	 * 
	 * @param String login
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 * @throws BackofficeDaoException if occurs another error.
	 */
	PositionAndroid getLastPositionbyUser(String login) throws BackofficeDBConnectionException, BackofficeDaoException;

	/**
	 *max speed recorded position of the User
	 * 
	 * @param String login
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 * @throws BackofficeDaoException if occurs another error.
	 */
	PositionAndroid getMaxSpeedByUser(String login) throws BackofficeDBConnectionException, BackofficeDaoException , BackofficeIllegalArgumentDaoException;

	
}
